
//点击导航
$('.footer-nav ul').on('click','li',function(e){
            var target = e.target;
            var id = $(target).data("to");
            console.log(this);
            $(this).css({"color":"#f7c857"}).siblings().css({"color":"black"});
            $('html,body').animate({scrollTop:$('#'+id).offset().top}, 500);
        });

$('.js-schedule-content').on('click','li',function(e){
            var target = e.target;
            var id = $(this).data("to");
            console.log(this);
            console.log(id);
            console.log($('#'+id));
            $('#'+id).css({"opacity":"1","z-index":"10"}).siblings().not("ul").css({"opacity":"0","z-index":"0"});
            $(this).addClass("active").siblings("").removeClass("active")
            // $('html,body').animate({scrollTop:$('#'+id).offset().top}, 500);
        });
$('.js-click-title').on('click','li',function(e){
            var target = e.target;
            var id = $(this).data("change");
            console.log(this);
            console.log(id);
            console.log($('#'+id));
            $('#'+id).css({"opacity":"1","z-index":"10"}).siblings().not("ul").css({"opacity":"0","z-index":"0"});
            $(this).find("h2").addClass("active").parents().siblings("").find("h2").removeClass("active")
        });
$('.js-informat-change').on('click','li',function(e){
            var target = e.target;
            var id = $(this).data("to");
            console.log(this);
            console.log(id);
            console.log($('#'+id));
            $('#'+id).css({"opacity":"1","z-index":"10"}).siblings().not("ul").css({"opacity":"0","z-index":"0"});
            $(this).addClass("active").siblings("").removeClass("active")
        });
$('.js-eventvideo-title ul').on('click','li',function(e){
            var target = e.target;
            var id = $(this).data("into");
            console.log(this);
            console.log(id);
            console.log($('#'+id));
            $('#'+id).css({"opacity":"1","z-index":"10"}).siblings().not("ul").css({"opacity":"0","z-index":"0"});
            $(this).addClass("active").siblings("").removeClass("active")
        });
$('.js-page-nav').on('click','li',function(e){
            var target = e.target;
            var _class = $(this).data("class");
            console.log(this);
            console.log(_class);
            console.log($('#'+_class));
              $('html,body').animate({scrollTop:$('.'+_class).offset().top}, 500);
            $('#'+_class).css({"opacity":"1","z-index":"10"}).siblings().not("ul").css({"opacity":"0","z-index":"0"});
            $(this).addClass("active").siblings("").removeClass("active")
        });

//查看更多视频
$(".js-seen-morevideo").on("click",function(){
  $(".video-display-more").css({"display":"inline-block"});
  var contentHeight = $("#contest_video ul").height();
  $("#contest_video").height(contentHeight)
  $(".event-content").height(contentHeight + 25);
  $(this).hide()
  $(".seen-lessvideo-btn").show()
})

// 收起视频回顾
$(".js-seen-lessvideo").on("click",function(){
  $(".video-display-more").css({"display":"none"});
  var contentHeight = $("#contest_video ul").height();
  $("#contest_video").height(contentHeight)
  $(".event-content").height(contentHeight + 25);
  $(this).hide();
  $(".seen-morevideo-btn").show()
})

//讲师团队
$(".teaminfo-content dl").on({
  "mouseover": function(){
    $(this).find(".info-content").addClass('active')
    $(this).siblings().find(".info-content").removeClass("active")
    $(".info-content").height($(this).find("dt").height())
    return false
  }
})



//回到页面顶部
$(".go_to_header").click(function() {
      $("html,body").animate({scrollTop:0}, 500);
      return false;
  });
window.onload=function(){
   var container = $(".carousel"),
       list = $(".carousel-inner");
       buttons = $(".carousel-buttons li")
       imgWidth = $(window).width()


    }

// 导航的现实与掩藏
$(window).bind("scroll", function(){
  var top = $(this).scrollTop();
  var placeDisplaynone = $(".business-intro").offset().top - 890;
  var placeDisplayBlock = $(".techer-info").offset().top - 890;
  // console.log(top);
  // console.log(placeDisplaynone);
  if (top >= placeDisplaynone) {
    $(".page-nav").css({"position":"absolute"})
  }
  if(top <= placeDisplayBlock){
    $(".page-nav").css({"position":"fixed"})
  }
})

// 关于我们 轮播
setInterval(businessCarousel,5000)
$(".carousel").height($(".carousel-inner").height())
$(".carousel .carousel-inner .item").width($(window).width()).height(300*$(window).width()/1920)
function businessCarousel(){
  var imgBox = $(".business-intro .carousel-inner");
  var imgItem = imgBox.find(".item").width();
  var masterLeft = imgBox.width() - imgItem -1;
  var newLeft;
  if(imgBox.position().left == -masterLeft){
    // console.log("aaa");
    newLeft = 0;
  }else {
    newLeft = parseInt(imgBox.position().left) - imgItem;
  }
  index++;
  if(index > 2){index = 0;}

  imgBox.css({"left":newLeft + "px"})
  showCurrentDot()
  }

  var index = 0;
  function showCurrentDot(){
    var dots = $(".carousel-indicators li")
    for(var i=1,len = $(dots).length; i < len;i++){
      $(dots).attr("class","")
    }
    // console.log("index:"+index);
    $(dots).eq(index).attr("class","on")
}

//回到页面底部
$('.go-footer-btn').click(function(){
  $('html,body').animate({scrollTop: $('footer').offset().top},500);
  return false;
});

$(window).scroll(function(){

})
